********************************************************************************
* appendix table 7: nf robustness

********************************************************************************

cd "$main_dir/data"

* no pioneer
use near_far_np,clear
egen ring_fe=group(building_id l250)
gen zero=0
gen treated=l250
gen treated_after=treated*(gap>=0)

reghdfe lrent treated_after /// 
	i.listing_bedroom i.listing_bathroom ///
	if building_sample==1 &  tx250_min_number>0 & tx256_min_number>0 ///
	[aweight=building_sample_weight] ,absorb(ring_fe building_id_year) vce(cl building_id)

	
* the same file is used for the other three columns
use near_far_m600_i250_g,clear

gen treated=l250
gen treated_after=treated*(gap>=0)
egen ring_fe=group(building_id l250)

* low percent white

reghdfe lrent treated_after /// 
	i.listing_bedroom i.listing_bathroom ///
	if building_pct_white<.5 & building_sample==1 & tx250_min_number>0 & tx256_min_number>0 ///
	[aweight=building_sample_weight] ,absorb(ring_fe building_id_year) vce(cl building_id)


* use the lower g cutoff
gen alt_g=0
replace alt_g = 1 if msa=="atlanta" & building_med_hh_inc<56000
replace alt_g = 1 if msa=="austin" & building_med_hh_inc<64000
replace alt_g = 1 if msa=="chicago" & building_med_hh_inc<59000
replace alt_g = 1 if msa=="denver" & building_med_hh_inc<67000
replace alt_g = 1 if msa=="la" & building_med_hh_inc<60000
replace alt_g = 1 if msa=="brooklyn" & building_med_hh_inc<66000
replace alt_g = 1 if msa=="philadelphia" & building_med_hh_inc<59000
replace alt_g = 1 if msa=="portland" & building_med_hh_inc<62000
replace alt_g = 1 if msa=="sf" & building_med_hh_inc<86000
replace alt_g = 1 if msa=="seattle" & building_med_hh_inc<73000
replace alt_g = 1 if msa=="dc" & building_med_hh_inc<73000

reghdfe lrent treated_after /// 
	i.listing_bedroom i.listing_bathroom ///
	if alt_g==1 & building_sample==1 & tx250_min_number>0 & tx256_min_number>0 ///
	[aweight=building_sample_weight] ,absorb(ring_fe building_id_year) vce(cl building_id)

* drop new york

reghdfe lrent treated_after /// 
	i.listing_bedroom i.listing_bathroom ///
	if msa!="brooklyn" &  building_sample==1 & tx250_min_number>0 & tx256_min_number>0 ///
	[aweight=building_sample_weight] ,absorb(ring_fe building_id_year) vce(cl building_id)



